package com.smh.a03UDPDemo2;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class SendMessageDemo {
    public static void main(String[] args) throws IOException {

        DatagramSocket ds = new DatagramSocket();
        Scanner scanner = new Scanner(System.in);
        while (true) {

            String s = scanner.nextLine();

            byte[] bytes = s.getBytes();
            InetAddress address = InetAddress.getByName("127.0.0.1");

            DatagramPacket dp = new DatagramPacket(bytes, bytes.length, address, 10086);

            ds.send(dp);
            if (s.contains("886")) {
                break;
            }
        }

        ds.close();

    }
}
